<template>
  <div class="docs-page">


    <!-- 文档内容 -->
    <div class="docs-content">
      <div class="docs-container">
        <!-- 目录导航 -->
        <div class="docs-sidebar">
          <div class="sidebar-content">
            <h3 class="sidebar-title">目录</h3>
            <ul class="sidebar-menu">
              <li><a href="#quick-start" @click.prevent="scrollToSection('quick-start')">快速开始</a></li>
              <li><a href="#create-app" @click.prevent="scrollToSection('create-app')">创建应用</a></li>
              <li><a href="#chat-tips" @click.prevent="scrollToSection('chat-tips')">对话技巧</a></li>
              <li><a href="#deploy" @click.prevent="scrollToSection('deploy')">部署应用</a></li>
              <li><a href="#features" @click.prevent="scrollToSection('features')">功能介绍</a></li>
              <li><a href="#faq" @click.prevent="scrollToSection('faq')">常见问题</a></li>
            </ul>
          </div>
        </div>

        <!-- 主要内容区 -->
        <div class="docs-main">
          <!-- 快速开始 -->
          <section id="quick-start" class="docs-section">
            <h2 class="section-title">🚀 快速开始</h2>
            <div class="section-content">
              <p>欢迎使用快码AI！只需简单几步，您就可以创建属于自己的应用。</p>

              <div class="step-cards">
                <div class="step-card">
                  <div class="step-number">1</div>
                  <h3>注册账号</h3>
                  <p>点击右上角的"注册"按钮，创建您的快码AI账号</p>
                </div>
                <div class="step-card">
                  <div class="step-number">2</div>
                  <h3>描述需求</h3>
                  <p>在首页输入框中详细描述您想要创建的应用</p>
                </div>
                <div class="step-card">
                  <div class="step-number">3</div>
                  <h3>AI生成</h3>
                  <p>AI将根据您的描述自动生成完整的应用代码</p>
                </div>
                <div class="step-card">
                  <div class="step-number">4</div>
                  <h3>部署上线</h3>
                  <p>一键部署您的应用，分享给全世界</p>
                </div>
              </div>
            </div>
          </section>

          <!-- 创建应用 -->
          <section id="create-app" class="docs-section">
            <h2 class="section-title">🎨 创建应用</h2>
            <div class="section-content">
              <h3>如何写出好的应用描述</h3>
              <div class="tip-box success">
                <h4>✅ 好的描述示例：</h4>
                <ul>
                  <li>"一个简约的待办事项管理工具，支持添加、删除、完成任务，有漂亮的界面设计"</li>
                  <li>"个人博客网站，包含文章列表、详情页、分类筛选，响应式设计适配手机"</li>
                  <li>"在线计算器应用，支持基础四则运算和科学计算，界面现代美观"</li>
                </ul>
              </div>

              <div class="tip-box warning">
                <h4>❌ 避免这样描述：</h4>
                <ul>
                  <li>"做个网站" - 太过简单，缺乏具体信息</li>
                  <li>"复杂的企业管理系统" - 描述过于宽泛</li>
                  <li>"和某某网站一样的功能" - 参考不明确</li>
                </ul>
              </div>

              <h3>使用优化功能</h3>
              <p>如果您的描述比较简单，可以点击"优化"按钮，AI会帮您完善描述内容，提升生成效果。</p>

              <h3>上传文档</h3>
              <p>您可以上传 .txt、.md、.doc 等格式的文档，系统会自动读取内容作为应用需求描述。</p>
            </div>
          </section>

          <!-- 对话技巧 -->
          <section id="chat-tips" class="docs-section">
            <h2 class="section-title">💬 对话技巧</h2>
            <div class="section-content">
              <h3>如何与AI高效对话</h3>
              <div class="tips-grid">
                <div class="tip-item">
                  <h4>🎯 明确具体</h4>
                  <p>描述要具体明确，包含功能、样式、交互等细节</p>
                </div>
                <div class="tip-item">
                  <h4>🔄 逐步迭代</h4>
                  <p>先创建基本功能，再逐步完善和优化</p>
                </div>
                <div class="tip-item">
                  <h4>🎨 重视设计</h4>
                  <p>描述界面风格、颜色搭配、布局要求</p>
                </div>
                <div class="tip-item">
                  <h4>📱 考虑适配</h4>
                  <p>说明是否需要响应式设计、移动端适配</p>
                </div>
              </div>

              <h3>常用对话模板</h3>
              <div class="template-box">
                <h4>功能修改：</h4>
                <p>"请在当前应用中添加[具体功能]"</p>
                <p>"请修改[具体位置]的[具体内容]为[新内容]"</p>
              </div>
              <div class="template-box">
                <h4>样式调整：</h4>
                <p>"请将整体色调改为[颜色风格]"</p>
                <p>"请优化界面布局，让它更现代化"</p>
              </div>
            </div>
          </section>

          <!-- 部署应用 -->
          <section id="deploy" class="docs-section">
            <h2 class="section-title">🚀 部署应用</h2>
            <div class="section-content">
              <h3>一键部署</h3>
              <p>当您对应用效果满意后，可以点击聊天页面右上角的"部署"按钮，将应用发布到互联网。</p>

              <div class="feature-list">
                <div class="feature-item">
                  <span class="feature-icon">⚡</span>
                  <div>
                    <h4>快速部署</h4>
                    <p>几秒钟内完成部署，获得专属访问链接</p>
                  </div>
                </div>
                <div class="feature-item">
                  <span class="feature-icon">🔗</span>
                  <div>
                    <h4>独立域名</h4>
                    <p>每个应用都有独立的访问地址</p>
                  </div>
                </div>
                <div class="feature-item">
                  <span class="feature-icon">📊</span>
                  <div>
                    <h4>实时更新</h4>
                    <p>修改应用后重新部署即可更新线上版本</p>
                  </div>
                </div>
              </div>

              <h3>下载代码</h3>
              <p>您也可以下载完整的源代码包，部署到自己的服务器或进行二次开发。</p>
            </div>
          </section>

          <!-- 功能介绍 -->
          <section id="features" class="docs-section">
            <h2 class="section-title">✨ 功能介绍</h2>
            <div class="section-content">
              <div class="features-grid">
                <div class="feature-card">
                  <div class="feature-header">
                    <span class="feature-icon">🤖</span>
                    <h3>AI智能生成</h3>
                  </div>
                  <p>基于先进的大语言模型，理解自然语言描述，生成高质量代码</p>
                </div>

                <div class="feature-card">
                  <div class="feature-header">
                    <span class="feature-icon">💬</span>
                    <h3>对话式开发</h3>
                  </div>
                  <p>通过自然语言对话，实时调整和完善应用功能</p>
                </div>

                <div class="feature-card">
                  <div class="feature-header">
                    <span class="feature-icon">🎨</span>
                    <h3>现代化界面</h3>
                  </div>
                  <p>自动生成响应式、美观的用户界面</p>
                </div>

                <div class="feature-card">
                  <div class="feature-header">
                    <span class="feature-icon">⚡</span>
                    <h3>快速部署</h3>
                  </div>
                  <p>一键部署应用到云端，获得专属访问链接</p>
                </div>

                <div class="feature-card">
                  <div class="feature-header">
                    <span class="feature-icon">📦</span>
                    <h3>源码下载</h3>
                  </div>
                  <p>支持下载完整源码包，便于二次开发</p>
                </div>

                <div class="feature-card">
                  <div class="feature-header">
                    <span class="feature-icon">🔄</span>
                    <h3>实时预览</h3>
                  </div>
                  <p>修改即时生效，实时查看应用效果</p>
                </div>
              </div>
            </div>
          </section>

          <!-- 常见问题 -->
          <section id="faq" class="docs-section">
            <h2 class="section-title">❓ 常见问题</h2>
            <div class="section-content">
              <div class="faq-list">
                <div class="faq-item">
                  <h3>Q: 生成的应用可以商用吗？</h3>
                  <p>A: 可以。您通过快码AI生成的应用完全属于您，可以自由使用、修改和商业化。</p>
                </div>

                <div class="faq-item">
                  <h3>Q: 支持哪些类型的应用？</h3>
                  <p>A: 目前主要支持前端Web应用，如网站、工具、游戏等。后续会支持更多类型。</p>
                </div>

                <div class="faq-item">
                  <h3>Q: 生成的代码质量如何？</h3>
                  <p>A: 我们使用最先进的AI模型，生成的代码遵循最佳实践，具有良好的可读性和可维护性。</p>
                </div>

                <div class="faq-item">
                  <h3>Q: 可以修改生成的应用吗？</h3>
                  <p>A: 当然可以。您可以通过对话继续调整，也可以下载源码自行修改。</p>
                </div>

                <div class="faq-item">
                  <h3>Q: 部署的应用会一直在线吗？</h3>
                  <p>A: 是的，部署后的应用会持续在线运行，您可以随时访问和分享。</p>
                </div>

                <div class="faq-item">
                  <h3>Q: 如何获得技术支持？</h3>
                  <p>A: 如果遇到问题，您可以通过应用内的反馈功能联系我们，我们会及时回复。</p>
                </div>
              </div>
            </div>
          </section>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { onMounted } from 'vue'

// 滚动到指定章节
const scrollToSection = (sectionId: string) => {
  const element = document.getElementById(sectionId)
  if (element) {
    element.scrollIntoView({
      behavior: 'smooth',
      block: 'start'
    })
  }
}

onMounted(() => {
  // 页面加载时检查是否有锚点
  const hash = window.location.hash
  if (hash) {
    const sectionId = hash.substring(1)
    setTimeout(() => {
      scrollToSection(sectionId)
    }, 100)
  }
})
</script>

<style scoped>
.docs-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #f8faff 0%, #f0f4ff 100%);
}

/* 文档头部 */
.docs-header {
  background: linear-gradient(135deg, #1890ff 0%, #40a9ff 100%);
  color: white;
  padding: 80px 0 60px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.docs-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
  animation: floating 6s ease-in-out infinite;
}

@keyframes floating {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

.docs-hero {
  position: relative;
  z-index: 1;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px;
}

.docs-title {
  font-size: 48px;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.title-icon {
  font-size: 52px;
}

.docs-subtitle {
  font-size: 20px;
  opacity: 0.9;
  font-weight: 400;
  line-height: 1.5;
}

/* 文档内容 */
.docs-content {
  padding: 60px 20px;
}

.docs-container {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 60px;
}

/* 侧边栏 */
.docs-sidebar {
  position: sticky;
  top: 100px;
  height: fit-content;
}

.sidebar-content {
  background: white;
  padding: 24px;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.sidebar-title {
  font-size: 18px;
  font-weight: 600;
  color: #262626;
  margin-bottom: 20px;
}

.sidebar-menu {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-menu li {
  margin-bottom: 8px;
}

.sidebar-menu a {
  display: block;
  padding: 12px 16px;
  color: #595959;
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s ease;
  font-weight: 500;
}

.sidebar-menu a:hover {
  background: rgba(24, 144, 255, 0.08);
  color: #1890ff;
  transform: translateX(4px);
}

/* 主要内容 */
.docs-main {
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.05);
  overflow: hidden;
}

.docs-section {
  padding: 40px;
  border-bottom: 1px solid #f0f0f0;
}

.docs-section:last-child {
  border-bottom: none;
}

.section-title {
  font-size: 32px;
  font-weight: 600;
  color: #262626;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-content {
  line-height: 1.7;
  color: #595959;
}

.section-content h3 {
  font-size: 20px;
  font-weight: 600;
  color: #262626;
  margin: 32px 0 16px 0;
}

.section-content h4 {
  font-size: 16px;
  font-weight: 600;
  color: #262626;
  margin: 24px 0 12px 0;
}

.section-content p {
  margin-bottom: 16px;
  font-size: 15px;
}

/* 步骤卡片 */
.step-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 24px;
  margin: 32px 0;
}

.step-card {
  background: linear-gradient(135deg, #f8faff 0%, #f0f4ff 100%);
  padding: 24px;
  border-radius: 12px;
  border: 2px solid rgba(24, 144, 255, 0.1);
  text-align: center;
  transition: all 0.3s ease;
}

.step-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(24, 144, 255, 0.15);
  border-color: rgba(24, 144, 255, 0.2);
}

.step-number {
  width: 48px;
  height: 48px;
  background: #1890ff;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 600;
  margin: 0 auto 16px;
}

.step-card h3 {
  color: #262626;
  margin-bottom: 12px;
  font-size: 18px;
}

.step-card p {
  color: #595959;
  font-size: 14px;
  margin: 0;
}

/* 提示框 */
.tip-box {
  padding: 20px;
  border-radius: 8px;
  margin: 20px 0;
  border-left: 4px solid;
}

.tip-box.success {
  background: rgba(82, 196, 26, 0.05);
  border-color: #52c41a;
}

.tip-box.warning {
  background: rgba(250, 173, 20, 0.05);
  border-color: #faad14;
}

.tip-box h4 {
  margin-top: 0;
  margin-bottom: 12px;
}

.tip-box ul {
  margin: 0;
  padding-left: 20px;
}

.tip-box li {
  margin-bottom: 8px;
}

/* 技巧网格 */
.tips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin: 24px 0;
}

.tip-item {
  background: rgba(24, 144, 255, 0.03);
  padding: 20px;
  border-radius: 12px;
  border: 1px solid rgba(24, 144, 255, 0.1);
}

.tip-item h4 {
  color: #1890ff;
  margin-bottom: 8px;
  font-size: 16px;
}

.tip-item p {
  margin: 0;
  font-size: 14px;
  color: #595959;
}

/* 模板框 */
.template-box {
  background: #f8f9fa;
  padding: 16px;
  border-radius: 8px;
  margin: 16px 0;
  border: 1px solid #e9ecef;
}

.template-box h4 {
  margin-bottom: 8px;
  color: #495057;
}

.template-box p {
  font-family: 'Monaco', 'Consolas', monospace;
  background: white;
  padding: 8px 12px;
  border-radius: 4px;
  border: 1px solid #dee2e6;
  margin: 4px 0;
  font-size: 13px;
  color: #495057;
}

/* 功能列表 */
.feature-list {
  margin: 24px 0;
}

.feature-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.feature-icon {
  font-size: 24px;
  flex-shrink: 0;
  margin-top: 4px;
}

.feature-item h4 {
  margin-bottom: 4px;
  color: #262626;
}

.feature-item p {
  margin: 0;
  color: #595959;
  font-size: 14px;
}

/* 功能网格 */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  margin: 24px 0;
}

.feature-card {
  background: linear-gradient(135deg, #f8faff 0%, #f0f4ff 100%);
  padding: 24px;
  border-radius: 12px;
  border: 1px solid rgba(24, 144, 255, 0.1);
  transition: all 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(24, 144, 255, 0.15);
  border-color: rgba(24, 144, 255, 0.2);
}

.feature-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.feature-card .feature-icon {
  font-size: 28px;
}

.feature-card h3 {
  margin: 0;
  color: #262626;
  font-size: 18px;
}

.feature-card p {
  margin: 0;
  color: #595959;
  font-size: 14px;
  line-height: 1.5;
}

/* FAQ */
.faq-list {
  margin: 24px 0;
}

.faq-item {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid #f0f0f0;
}

.faq-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.faq-item h3 {
  color: #262626;
  margin-bottom: 8px;
  font-size: 16px;
}

.faq-item p {
  margin: 0;
  color: #595959;
  font-size: 15px;
}

/* 响应式设计 */
@media (max-width: 1024px) {
  .docs-container {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .docs-sidebar {
    position: relative;
    top: 0;
  }

  .sidebar-content {
    display: none;
  }
}

@media (max-width: 768px) {
  .docs-title {
    font-size: 36px;
  }

  .docs-subtitle {
    font-size: 16px;
  }

  .docs-content {
    padding: 40px 16px;
  }

  .docs-section {
    padding: 24px 20px;
  }

  .section-title {
    font-size: 24px;
  }

  .step-cards {
    grid-template-columns: 1fr;
  }

  .tips-grid {
    grid-template-columns: 1fr;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .docs-title {
    font-size: 28px;
    flex-direction: column;
    gap: 8px;
  }

  .title-icon {
    font-size: 40px;
  }

  .docs-section {
    padding: 20px 16px;
  }
}
</style>
